<template>
  <up-tabbar :value="tabIndex" :fixed="true" :placeholder="false" :safe-area-inset-bottom="false" @change="go">
    <up-tabbar-item text="论坛" icon="home"></up-tabbar-item>
    <up-tabbar-item text="搭子" icon="photo"></up-tabbar-item>
    <up-tabbar-item text="消息" icon="home"></up-tabbar-item>
    <up-tabbar-item text="我的" icon="account"></up-tabbar-item>
  </up-tabbar>
  <up-picker :show="show" :columns="columns" @confirm="confirm" @cancel="cancel"></up-picker>
  <!-- <up-popup :show="show" mode="bottom">
		<view>
			<up-dropdown>
				<up-dropdown-item v-model="value1" title="距离" :options="options"></up-dropdown-item>
			</up-dropdown>
		</view>
	</up-popup> -->
</template>

<script setup lang="ts">
import { dbGet } from '@/utils/db';
import { computed, ref } from 'vue';
const router = [
	"/pages/forum/index",
	"/pages/partner/index",
	"/pages/message/index",
	"/pages/home/index"
]
const columns = ref([
	["普通搭子", '轻度障碍搭子', '搭子列表']
]);
const show = ref(false);
const go = (index :number) => {
	// 进入搭子界面，判断是否是首次进入,
	if(index === 1){
		// 如果没有进入过那个页面就跳到初次进入页面
		if(dbGet("daziFlag") !== "1"){
			uni.redirectTo({
				url:"/pages/partner/introduce"
			})
			return;
		}
	}
	uni.redirectTo({
		url: router[index]
	})
}
const cancel = (e) => {
	show.value = false
}
const tabIndex = computed(() => {
	const pageList = getCurrentPages();
	const page = pageList[pageList.length - 1].route;
	return router.indexOf("/" + page);
})
const confirm = ({ indexs }) => {
	switch (indexs.value) {
		case 1:
			break
		case 2:
			break
	}
}
</script>

<style></style>